/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package util.jQueryForm;

import java.util.List;
import java.util.Map;
import util.jQgrid.JSONUtil;
import util.jQueryForm.Dialog.jQueryFormDialog;

/**
 *
 * @author CHANWUT
 */
public class jQueryFormFormatterUtil {

    private jQueryFormContainer _container;

    /**
     * Convert Object to Json Data
     * @param attr
     * @param removeAttr
     * @param html
     * @param text
     * @param val
     * @param addClass
     * @param removeClass
     * @param toggleClass
     * @return Json String Format
     */
    public static String getJSON(
            List<jQueryFormSelector> attr,
            Map<String, String> removeAttr,
            Map<String, String> html,
            Map<String, String> text,
            Map<String, String> val,
            Map<String, String> addClass,
            Map<String, String> removeClass,
            Map<String, String> toggleClass,
            Map<String, String> showHide) {

        jQueryFormContainer container = new jQueryFormContainer();
        container.setAttr(attr);
        container.setRemoveAttr(removeAttr);
        container.setHtml(html);
        container.setText(text);
        container.setVal(val);
        container.setAddClass(addClass);
        container.setRemoveClass(removeClass);
        container.setToggleClass(toggleClass);
        container.setShowHide(showHide);
        return JSONUtil.convertToJSON(container);
    }

    // <editor-fold defaultstate="collapsed" desc="Builder Function">
    public jQueryFormFormatterUtil() {
        _container = new jQueryFormContainer();
    }

    public String buildJson()
    {
        return JSONUtil.convertToJSON(_container);
    }

    public jQueryFormFormatterUtil setAttr(List<jQueryFormSelector> attr)
    {
        this._container.setAttr(attr);
        return this;
    }

    public jQueryFormFormatterUtil setRemoveAttr(Map<String, String> removeAttr)
    {
        this._container.setRemoveAttr(removeAttr);
        return this;
    }

    public jQueryFormFormatterUtil setHtml(Map<String, String> html)
    {
        this._container.setHtml(html);
        return this;
    }

    public jQueryFormFormatterUtil setText(Map<String, String> text)
    {
        this._container.setText(text);
        return this;
    }

    public jQueryFormFormatterUtil setVal(Map<String, String> val)
    {
        this._container.setVal(val);
        return this;
    }

    public jQueryFormFormatterUtil setAddClass(Map<String, String> addClass)
    {
        this._container.setAddClass(addClass);
        return this;
    }

    public jQueryFormFormatterUtil setRemoveClass(Map<String, String> removeClass)
    {
        this._container.setRemoveClass(removeClass);
        return this;
    }

    public jQueryFormFormatterUtil setToggleClass(Map<String, String> toggleClass)
    {
        this._container.setToggleClass(toggleClass);
        return this;
    }

    public jQueryFormFormatterUtil setShowHide(Map<String, String> showHide)
    {
        this._container.setShowHide(showHide);
        return this;
    }

    public jQueryFormFormatterUtil setAppend(Map<String, String> append)
    {
        this._container.setAppend(append);
        return this;
    }

    public jQueryFormFormatterUtil setAppendTo(Map<String, String> appendTo)
    {
        this._container.setAppendTo(appendTo);
        return this;
    }

    public jQueryFormFormatterUtil setReplaceWith(Map<String, String> replaceWith)
    {
        this._container.setReplaceWith(replaceWith);
        return this;
    }

    public jQueryFormFormatterUtil setReplaceAll(Map<String, String> replaceAll)
    {
        this._container.setReplaceAll(replaceAll);
        return this;
    }

    public jQueryFormFormatterUtil setRemove(Map<String, String> remove)
    {
        this._container.setRemove(remove);
        return this;
    }

    public jQueryFormFormatterUtil setDetach(Map<String, String> detach)
    {
        this._container.setDetach(detach);
        return this;
    }

    public jQueryFormFormatterUtil setEmpty(Map<String, String> empty)
    {
        this._container.setEmpty(empty);
        return this;
    }

    public jQueryFormFormatterUtil setClone(Map<String, String> clone)
    {
        this._container.setClone(clone);
        return this;
    }

    public jQueryFormFormatterUtil setDialog(List<jQueryFormDialog> dialog)
    {
        this._container.setDialog(dialog);
        return this;
    }
    // </editor-fold>
}
